#include <iostream>

using std::cout;
using std::endl;

class NonCopyable
{
public:
    //3、将基类的拷贝构造与赋值运算符函数删除
    NonCopyable() = default;
    NonCopyable(const NonCopyable &rhs) = delete;
    NonCopyable &operator=(const NonCopyable &rhs) = delete;
    ~NonCopyable() = default;
};

class Example
: NonCopyable
{
public:
    Example() = default;
    /* Example() ; */

    //2、可以将拷贝构造函数与赋值运算符函数删除
    /* Example(const Example &rhs) = delete; */
    /* Example &operator=(const Example &rhs) = delete; */
private:
    //1、将拷贝构造函数与赋值运算符函数设置为私有的
    /* Example(const Example &rhs); */
    /* Example &operator=(const Example &rhs); */
};

void test()
{
    Example ex1;
    Example ex2 = ex1;//拷贝,error

    cout << endl;
    Example ex3;

    ex3 = ex1;//赋值,error
}

int main(int argc, char *argv[])
{
    test();
    return 0;
}

